<?php
if(@$_SESSION['idUser']){
	$idUser = $_SESSION['idUser'];
	$avatar = url_hinh_user_40x40.$_SESSION['avatar_user'].'.jpg';
	$ds_traloi = $tc->ds_traloi_ketban($idUser);/*ds ket ban*/
	$total_ds_traloi = mysql_num_rows($ds_traloi);
	$ketban = $tc->kiemtra_ketban($idUser,$user);
	$notification = '<a href="javascript:void();" id="notification" status="1"><img style="margin: 14px 0 0 40px; float:left" src="images/notification.jpg" /></a>';
	
	$qr_notification = $tc->notification($idUser);
	if(mysql_num_rows($qr_notification)>0){
		$view_notification = '<div id="view_notification"><div style="clear:both; line-height:30px; font-weight:bold; color:#FE4D81; padding:0 20px; border-bottom:solid 1px #999; background-color:#FFF">Thông báo</div>';
		while($row_notification = mysql_fetch_array($qr_notification)){
			$noti_user = $tc->user_info($row_notification['user_id']);
			$row_noti_user = mysql_fetch_array($noti_user);
			$view_notification .= '<div class="item"><p><a href="'.$row_notification['user_id'].'/"><img src="'.url_hinh_user_40x40.$row_noti_user['avatar'].'.jpg" alt="'.$row_noti_user['name'].'" /><b style="color:#FE4D81">'.$row_noti_user['name'].'</b></a> <a href="index.html?user='.$row_notification['user_id'].'&type=detail&id='.$row_notification['info_id'].'" style="color:#666">'.$row_notification['status'].'</a></p><hr /></div>';
		}
		$view_notification .= '</div>';
	}
	
	if($total_ds_traloi>0) $total_ds_traloi = '<a href="index.html?user='.$idUser.'&type=traloi"><img style="margin: 14px 0 0 20px; float:left" src="images/world.jpg" /> &nbsp; có '.$total_ds_traloi.' lời mời kết bạn</a>'; else $total_ds_traloi = '';
	$search_frm = '<div id="search"><div id="box_kq"></div><input type="text" name="search" id="txtSearch" value="Search friend by name and email" onclick="if(txtSearch.value==\'Search friend by name and email\') txtSearch.value=\'\'" onblur="if(txtSearch.value==\'\') txtSearch.value=\'Search friend by name and email\'" /></div>';
	$wall_status = '<div id="status"><div class="item"><a href="javascript:;" style="background:url(images/trangthai.jpg) no-repeat left" id="trangthai">Trạng thái</a><a href="javascript:;" style="background:url(images/hinhanh.jpg) no-repeat left" id="hinhanh">Hình ảnh</a></div><div id="loading_wall"></div><div id="ajax_wall"><div class="content"><div style="width:1px; height:1px; overflow:hidden"><textarea  name="content" id="editor1" style="display:none"></textarea><p id="eMessage" style="display:none"></p><script>CKEDITOR.replace("editor1", {enterMode: CKEDITOR.ENTER_BR,on: {focus: onFocus,blur: onBlur,}});</script></div><textarea name="data" rows="3" id="textarea">Bé thế nào rồi...</textarea><div id="status_action"><select name="share" class="share"><option value="1">Công khai</option><option value="3">Chỉ mình tôi</option></select><input type="image" name="btnstatus" src="images/dang_wall.jpg" id="btnstatus" alt="Đăng" onclick="InsertText();" /><input type="hidden" name="photo_name" class="photo_name" size="50" /></div></div><div id="frmUpload"><div class="pic_box"></div><div id="pic_box_load"></div><div id="btn_upload"><form id="imageform" method="post" enctype="multipart/form-data" action="upload.php"><span style="color:#333; font-weight:bold">Tải ảnh: </span><input type="file" name="photoimg" id="photoimg" accept="image/jpeg,image/x-png,image/gif,image/x-ms-bmp" /></form></div><div style="clear:both; height:1px"></div></div></div></div>';
	if($_GET['create']==1 && $idUser==$user){
		$create_frm_album = '<div id="create"><div id="create_frm"><p style="margin-left:110px"><select name="share" class="share"><option value="1">Công khai</option><option value="3">Chỉ mình tôi</option></select></p><br /><b>Tên album ảnh:</b> <input type="text" name="name_album" size="40" /><input type="button" name="create_album" value="Tạo album" /></div><div id="create_id"></div><div id="frmUpload"><div class="pic_box"></div><div id="pic_box_load"></div><div id="btn_upload"><div class="photo_name"></div><form id="imageform" method="post" enctype="multipart/form-data" action="upload.php"><div style="width:400px; float:left"><span>Tải ảnh:</span> <input type="file" name="photoimg" id="photoimg" accept="image/jpeg,image/x-png,image/gif,image/x-ms-bmp" /></div><div style="float:right; line-height:25px; font-weight:bold; text-align:right; padding:3px 20px"><a href="index.html?user='.$user.'&type=photos">Kết thúc</a></div><div style="clear:both; height:1px"></div></form></div><div style="clear:both; height:1px"></div></div></div>';
		$add_image = '<div class="add_image"><div id="frmUpload"><div class="pic_box"></div><div id="pic_box_load"></div><div id="btn_upload" style="clear:both; padding:10px 0"><form id="imageform" method="post" enctype="multipart/form-data" action="upload.php"><span style="color:#333; font-weight:bold">Tải ảnh: </span><input type="file" name="photoimg" id="photoimg" accept="image/jpeg,image/x-png,image/gif,image/x-ms-bmp" /></form></div><div style="clear:both; height:1px"></div></div> <div><a href="index.html?user='.$idUser.'&type=all-pic&album='.$album_id.'">Kết thúc đăng ảnh</a></div> <script type="text/javascript" src="library/jquery.form.js"></script><script type="text/javascript" >$(document).ready(function(){ $("#photoimg").live("change",function(){$("#pic_box_load").html("");$("#pic_box_load").html(\'<img src="images/loader.gif" width="150" height="19" alt="Uploading...."/>\');$("#imageform").ajaxForm({target: ".pic_box"}).submit();});}); </script></div>';
	}elseif($_GET['create']==2 && $idUser==$user){
		$create_frm_album = '<div id="create"><strong>Thông tin này chỉ có bạn mới thấy:</strong><div id="create_frm"><form action="" name="nhatky" method="post">
		<table width="550" border="0" cellpadding="0" cellspacing="8">
			<tr><td>&nbsp;</td><td><select name="share" class="share" style="margin-left:5px"><option value="1">Công khai</option><option value="3">Chỉ mình tôi</option></select></td></tr>
			<tr>
				<td width="80">Tiêu đề:</td>
				<td><input type="text" name="name" style="width:330px" /></td>
			</tr>
			<tr><td valign="top">Nội dung:</td><td style="padding-left:5px"><div style="width:1px; height:1px; overflow:hidden"><textarea  name="content" id="editor1" style="display:none"></textarea><p id="eMessage" style="display:none"></p><script>CKEDITOR.replace("editor1", {enterMode: CKEDITOR.ENTER_BR,on: {focus: onFocus,blur: onBlur,}});</script></div><textarea name="data" rows="8" style="width:350px; line-height:22px" id="textarea"></textarea></td></tr>
			<tr><td>&nbsp;</td><td><input type="submit" name="btnnhatky" id="btnstatus" value="Đăng nhật ký" onclick="InsertText();" /></td></tr>
		</table></form></div></div>';
	}else ;
	if($idUser==$user){
		$btn_update_be = '<a href="index.html?user='.$idUser.'&type=information&ac=upbe"><img src="images/update_btn.jpg" alt="create album" /></a>';
		$btn_update_me = '<a href="index.html?user='.$idUser.'&type=information&ac=upme"><img src="images/update_btn.jpg" alt="create album" /></a>';
		$doiavatar = '<div style="color:#ff4e83; width:200px; float:left; font-weight:bold; font-size:16px; padding:10px 0 20px 10px"><a href="index.html?user='.$idUser.'&type=all-pic&album='.$_SESSION['album_anh_daidien'].'">Cập nhật ảnh đại diện</a></div>';
		$doimatkhau = '<div style="color:#ff4e83; width:130px; float:left; font-weight:bold; font-size:16px; padding:10px 0 20px 10px"><a href="index.html?user='.$idUser.'&type=information&ac=pass">Đổi mật khẩu</a></div>';
		$add_children = '<p align="right"><a href="index.html?user='.$idUser.'&type=information&ac=children">Thêm mới</a></p>';
		$btn_add = '<a href="index.html?user='.$idUser.'&type=all-pic&album='.$album_id.'&create=1" id="add_image">Thêm ảnh</a>';
		$create_photo = '<a href="index.html?user='.$idUser.'&type=photos&create=1">Tạo Album</a> <a href="index.html?user='.$idUser.'&type=photos&create=2">Nhật ký</a>';
	}
}